package com.hxs.colorfultest2.service.impl;


import com.hxs.colorfultest2.dao.ThemeDao;
import com.hxs.colorfultest2.domain.Theme;
import com.hxs.colorfultest2.service.ThemeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ThemeServiceImpl implements ThemeService {
    @Autowired
    ThemeDao themeDao;

    /*添加主题*/
    @Override
    public void addTheme(Theme theme) {
        themeDao.addTheme(theme);
    }

    /**/
    @Override
    public List<Theme> getAllTheme() {
        return themeDao.getAllTheme();
    }

    /*更新主题*/
    @Override
    public void updateTheme(Theme theme) {
               themeDao.updateTheme(theme);
    }

    /*获取分页主题数量*/
    @Override
    public int getThemeByTotal() {
        return themeDao.getThemeByTotal();
    }

    /*获取每页主题*/
    @Override
    public List<Theme> getThemeByPage(Map<String, Object> paramMap) {
        return themeDao.getThemeByPage(paramMap);
    }

    /*主题名查重*/
    @Override
    public boolean checkName(String name) {
        return themeDao.checkName(name);
    }

    /*删除主题*/
    @Override
    public boolean deleteTheme(String name) {
        return themeDao.deleteTheme(name);
    }

    /*根据主题名获取主题*/
    @Override
    public Theme getThemeByName(String name) {
        return themeDao.getThemeByName(name);
    }

    /*根据主题ID查找主题*/
    public Theme getThemeByID(int id){
        return themeDao.getThemeByID(id);
    }

    /*获取删除的主题*/
    @Override
    public List<Theme> getDeleteTheme() {
        return themeDao.getDeleteTheme();
    }

    @Override
    public List<Theme> getThemeByFactory(String name) {

        return themeDao.getThemeByFactory(name);
    }
}
